<template>
  <div class="login_bg register">
  <div class='login_box'>
    <p class="login_box_logo"><img src="../common/images/logo.png" alt=""></p>
    <p class="marginTop20">大华科技原材料库存优化系统</p>
    <div class="login_text_box">
      <ul class="login_ul">
        <li style="position: relative;">
          <input type="text" placeholder="工号" class='admin' v-model="countName">
          <img src="../common/images/count.png" alt="">
        </li>
        <li style="position: relative;">
          <input type="password" class='admin_password' placeholder="密码" v-model="countPassword">
          <img src="../common/images/lock.png" alt="">
        </li>
        <li style="position: relative;">
          <input type="password" class='admin_password' placeholder="确认密码" v-model="countPassword1">
          <img src="../common/images/lock.png" alt="">
        </li>
        <li class="roleChoose">
          <span>角色选择：</span>
          <select name="" id="" v-model="check">
            <option value=""></option>
            <option value="1">管理员</option>
            <option value="2">采购员</option>
            <option value="3">sourcing</option>
            <option value="4">计划员</option>
            <option value="5">计划管理员</option>
            <option value="6">采购管理员</option>
          </select>
        </li>
        <!--<li class="clearfix checkLi">
        	<input type="radio" name="check" v-on:click="checkFunction(1)" />
        	<span class="checkName">管理员</span>
        	<input type="radio" name="check" v-on:click="checkFunction(2)" />
        	<span class="checkName">采购员</span>
        	<input type="radio" name="check" v-on:click="checkFunction(3)" />
        	<span class="checkName">sourcing</span>
        	<input type="radio" name="check" v-on:click="checkFunction(4)" />
        	<span class="checkName">计划员</span>
          <input type="radio" name="check" v-on:click="checkFunction(5)" />
          <span class="checkName">计划管理员</span>
          <input type="radio" name="check" v-on:click="checkFunction(6)" />
          <span class="checkName">采购管理员</span>
        </li>-->
      </ul>
      <div class="tc">
        <button class="login_btn" @click="goIndex()">注&nbsp;&nbsp;&nbsp;册</button>
      </div>
      <!-- <div class="login_tip dn">用户名或密码错误</div>-->
    </div>
  </div>
  </div>
</template>
<script>
  import common from '../common/js/common';

  export default {
    data(){
      return{
        countName:'',
        countPassword:'',
        countPassword1:"",
        check:""
      }
    },
    methods:{
      goIndex:function(){
        var _self=this;
        if(this.countName==''){
          alert('用户名不能为空')
        }else if(this.countPassword==''){
          alert('密码不能为空')
        }else if(this.countPassword1!=this.countPassword){
          alert('重复输入密码出错')
        }else if(this.check==""){
        	alert('请选择用户类型')
        }else{
          var yx_data={
            "employee_number": _self.countName,
            "password": _self.countPassword,
            "role_id":_self.check
          };
          common.getData(-1,common.url_constitute.register, "post", yx_data, function (d) {
            if(d.data.code==1024){
              _self.$router.push({path:'/login'})
            }else{
              alert(d.data.message)
            }
          });
        }
      },
    }
  }
</script>
<style>
  @import "../common/css/base.css";
  @import "../common/css/yx-login.less";
</style>
